package sg.edu.nus.iss.billing.parse;

import java.io.IOException;
import java.io.LineNumberReader;
import java.util.ArrayList;
import java.util.HashMap;
/**
 * @author sammil
 *
 */
public abstract class ParserState {

	public abstract <L> ParserState parse(LineNumberReader in, HashMap<String,ArrayList<L>> outputMap)
			throws IOException;

	protected RuntimeException createException(String messagePrefix,
			LineNumberReader in) throws IOException {

		int errorLineNum = in.getLineNumber();
		String errorLine = in.readLine();
		return new RuntimeException(messagePrefix + " starting at line "
				+ errorLineNum + "; got this instead: " + errorLine);
	}
}
